package com.smart.coupon.template.controller;

import com.qf.common.result.ResponseResult;
import com.smart.coupon.template.api.CouponTemplateApi;
import com.smart.coupon.template.dto.CouponDTO;
import com.smart.coupon.template.service.CouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.Min;
import java.util.List;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/template")
@Api(tags = "优惠券模板Api接口")
@Validated
public class CouponTemplateController implements CouponTemplateApi {
    @Resource
    private CouponService couponService;

    @ApiOperation("通过会员ID查询优惠券的信息")
    @ApiImplicitParam(name = "memberId", value = "会员ID", required = true, dataType = "Long")
    @Override
    public ResponseResult<List<CouponDTO>> list(@Min(1) @RequestParam Long memberId) {
        return ResponseResult.success(couponService.getCouponList(memberId));
    }

//    @PostMapping("/test")
//    public ResponseResult<List<CouponDTO>> test(@RequestBody Long memberId) {
//    }
}
